﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Api.Filter;
using Customer.Bussiness_Service;
using Entity;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using ServiceCore;

namespace Customer.Areas.RK.Controllers
{
    [ApiController, Area("RK"), Route("/[action]"), Customer_Admin]
    public class miniprogram_menuController : ControllerBase
    { 
        private readonly Iminiprogram_menu_service _service;
        private readonly IToole_DI _tool; 
        public miniprogram_menuController(Iminiprogram_menu_service service, IToole_DI tool)
        {
            _service = service;
            _tool = tool;
        }
        /// <summary>
        ///  获取角色列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public ResultListModel<miniprogram_menu> get_mini_menu_pagelist(Base_List_Params query)
        {
            var result = _service.get_mini_menu_pagelist(query);
            return result;
        } 
        /// <summary>
        ///  保存菜单
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public ResultObjModel save_mini_menu(miniprogram_menu Params)
        {
            var result = _service.save_mini_menu(Params);
            return result;
        }
        /// <summary>
        ///  删除小程序菜单
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpGet]
        public ResultModel del_mini_menu(string menu_id)
        {
            var result = _service.del_mini_menu(menu_id);
            return result;
        }
        /// <summary>
        ///  获取小程序树结构数据
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpGet]
        public ResultObjModel get_mini_menu_tree(string role_id)
        {
            var result = _service.get_mini_menu_tree(role_id);
            return result;
        }  
        /// <summary>
        ///  获取角色列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public ResultListModel<Role> get_role_list(Base_List_Params query)
        {
            var result = _service.get_role_list(query);
            return result;
        }
        /// <summary>
        ///  获取角色列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public ResultObjModel save_role(create_role_params Params)
        {
            var result = _service.save_role(Params);
            return result;
        }
    }
}